package cn.study.luckyinfrastructure.convertor;

import cn.study.luckyclient.dto.PrizeUpdateCmd;
import cn.study.luckydomain.award.AwardEntity;
import cn.study.luckydomain.award.AwardNumber;
import cn.study.luckyinfrastructure.gateway.iml.dataObject.AwardDB;

public class AwardConvertor {
    public static AwardEntity toEntity(AwardDB awardDB){
        AwardEntity awardEntity = new AwardEntity();
        awardEntity.setId(awardDB.getId());
        awardEntity.setActivityId(awardDB.getActivityId());
        awardEntity.setPrizeId(awardDB.getPrizeId());
        awardEntity.setNumber(new AwardNumber(awardDB.getNumber()));
        awardEntity.setAwardName(awardDB.getAwardName());
        awardEntity.setProbability(awardDB.getProbability());
        awardEntity.setCreateTime(awardDB.getCreateTime());
        awardEntity.setCreator(awardDB.getCreator());
        awardEntity.setUpdateTime(awardDB.getUpdateTime());
        awardEntity.setUpdater(awardDB.getUpdater());
        return awardEntity;
    }
    public static AwardDB toAwardDB(AwardEntity awardEntity){
        AwardDB awardDB = new AwardDB();
        awardDB.setId(awardEntity.getId());
        awardDB.setActivityId(awardEntity.getActivityId());
        awardDB.setPrizeId(awardEntity.getPrizeId());
        awardDB.setNumber(awardEntity.getNumber().getNumber());
        awardDB.setAwardName(awardEntity.getAwardName());
        awardDB.setProbability(awardEntity.getProbability());
        awardDB.setCreateTime(awardEntity.getCreateTime());
        awardDB.setCreator(awardEntity.getCreator());
        awardDB.setUpdateTime(awardEntity.getUpdateTime());
        awardDB.setUpdater(awardEntity.getUpdater());
        return awardDB;
    }
}
